package com.SmartCare.controller.client;

import com.SmartCare.common.Result;
import com.SmartCare.common.dto.BillDTO;
import com.SmartCare.common.note.Monitor;
import com.SmartCare.service.BillService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/client/bill")
@Api(tags = "C端账单")
@Slf4j
public class BillsController {

    @Resource
    BillService billService;

    @GetMapping("/get-all")
    public Result getAll() {
        return billService.getAll();
    }

    @Monitor(description = "家属查询账单", module = "账单模块")
    @GetMapping("/query")
    public Result getById(@RequestParam Long id) {
        return billService.getBillById(id);
    }

    @Monitor(description = "家属添加账单", module = "账单模块")
    @PostMapping("/add")
    public Result addBill(@RequestBody BillDTO bill) {
        return billService.add(bill);
    }
    @Monitor(description = "删除账单", module = "账单模块")
    @GetMapping("/delete")
    public Result deleteBill(@RequestParam List<Long> ids) {
        return billService.delete(ids);
    }
}
